# -*- coding: utf-8 -*- 
# @project : 《Atcoder》
# @Author : created by bensonrachel on 2021/12/11
# @File : 231.D - Neighbors.py
# DFS 做法判断无向图中是否有环
import sys
sys.setrecursionlimit(100000001)
n,m = map(int,input().split())
if m == 0:
    print("Yes")
    exit()
# d = dict()
l = [list() for i in range(n+1)]
degree = [0]*(n+1)
for i in range(m):
    a,b = map(int,input().split())
    l[a].append(b)
    l[b].append(a)
    degree[b] += 1
    degree[a] += 1

for x in degree:
    if x > 2:
        print("No")
        exit()


def dfs(k,p):
    visited[k]=1
    for c in l[k]:
        if c!=p:
            if visited[c]==1:
                return True
            dfs(c,k)
    return False
visited = [0]*(n+1)

for i in range(1,n+1):
    if visited[i] == 1:
        continue
    if dfs(i,0):
        print("No")
        exit()
print("Yes")


